package com.study.spark.scala.chapter07

import scala.collection.mutable.ArrayBuffer

object Scala03_Collection_1{
  def main(args: Array[String]): Unit = {
    // TODO 集合 - 常用方法
    // 获取部分数据
    val array = ArrayBuffer(1,2,3,4,5)
    println(array.head)//1
    println(array.last)//5
    println(array.take(3))//ArrayBuffer(1, 2, 3)
    println(array.takeRight(3))//ArrayBuffer(3, 4, 5)
    println(array.drop(3))//ArrayBuffer(4, 5)
    println(array.dropRight(3))//ArrayBuffer(1, 2)
    println(array.tail)//ArrayBuffer(2, 3, 4, 5)
    println(array.tails)//<iterator>
    println(array.tail.tail.tail)//ArrayBuffer(4, 5)
    println(array.init)//ArrayBuffer(1, 2, 3, 4)
    println(array.init.init.init)//ArrayBuffer(1, 2)






  }
}
